package com.evry.spring3sandbox.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.evry.spring3sandbox.domain.Customer;
import com.evry.spring3sandbox.domain.Order;
import com.evry.spring3sandbox.repository.CustomerDao;
import com.evry.spring3sandbox.repository.OrderDao;

@Service("customerManager")
@Transactional
public class SimpleCustomerManager implements CustomerManager {

	private static final long serialVersionUID = -7010821624164052421L;
	
	@Autowired
	private CustomerDao customerDao;
	@Autowired
	private OrderDao orderDao;

    public List<Order> getOrdersByCustomer(Customer customer) {
    	return orderDao.getOrdersByCustomer(customer);
    }
    
    public Customer getCustomerById(Integer id) {
    	return customerDao.getCustomerByID(id);
    }

	public List<Customer> getCustomers() {
		return customerDao.getCustomerList();
	}
   
}
